package src
{
	import flash.display.MovieClip;
	import flash.events.MouseEvent;
	
	public class Calculator extends MovieClip
	{ 
		
		public function Calculator()
		{			
			addEventListener(MouseEvent.CLICK,onClick);
		}
		private function onClick(event:MouseEvent):void{
			switch(event.target){
				case btn0: 
					//Para que no pueda figurar el cero si se clickea primero.
					if (calScreen.numbers.text !== ""){
					    calScreen.numbers.text = calScreen.numbers.text + (0).toString();
					}
					break;
				case btn1: calScreen.numbers.text = calScreen.numbers.text + (1).toString(); break; 
				case btn2: calScreen.numbers.text = calScreen.numbers.text + (2).toString(); break;
				case btn3: calScreen.numbers.text = calScreen.numbers.text + (3).toString(); break;
				case btn4: calScreen.numbers.text = calScreen.numbers.text + (4).toString(); break;
				case btn5: calScreen.numbers.text = calScreen.numbers.text + (5).toString(); break;
				case btn6: calScreen.numbers.text = calScreen.numbers.text + (6).toString(); break;
				case btn7: calScreen.numbers.text = calScreen.numbers.text + (7).toString(); break;
				case btn8: calScreen.numbers.text = calScreen.numbers.text + (8).toString(); break;
				case btn9: calScreen.numbers.text = calScreen.numbers.text + (9).toString(); break;
				case btnClear: calScreen.numbers.text = ""; break;
			}
			
		}
	}
}